from svn_controller import SvnController
from script_runner import executeCommand
from project_controller import ProjectController

###############################################################################


def main():
    projectController = ProjectController()
    projectController.run()
    #testSvn();
    #testCommandLine();
    


###############################################################################


def testSvn():
    svnController = SvnController()
    
    svnController.setUsername( 'anastasia' )
    svnController.setPassword( '1' )
    
    result = svnController.checkURL( "svn://localhost/home/anastasia/dev/svnrepo" )
    print result
    revision = svnController.getHeadRevision( "svn://localhost/home/anastasia/dev/svnrepo" )
    print revision
    
    result = svnController.checkURL( "svn://localhost/home/anastasia/dev/" )
    print result
    
    revision = svnController.getHeadRevision( "svn://localhost/home/anastasia/dev/" )
    print revision
    
    revision = svnController.getHeadRevision( "svn://localhost/home/anastasia/dev/svnrepo/main.cpp" )
    print revision
    
    revision = svnController.checkout( "svn://localhost/home/anastasia/dev/svnrepo", "/home/anastasia/tmp/svnrepo" )
    print "checkout", revision
    
    revision = svnController.update( "/home/anastasia/tmp/svnrepo" )
    print "update", revision
    
    svnController.setUsername( 'anastasia1' )
    svnController.setPassword( '1' )
    
    result = svnController.checkURL( "svn://localhost/home/anastasia/dev/svnrepo" )
    print result
    
    result = svnController.checkURL( "svn://localhost/home/anastasia/dev/" )
    print result

    
###############################################################################


def testCommandLine():
    log, err, result = executeCommand( "ls -l" )
    print "log :", log
    print "errors :", err
    print "return ccode :", result
    
    log, err, result = executeCommand( "lsa" )
    print "log :", log
    print "errors :", err
    print "return ccode :", result

    
###############################################################################


if __name__ == '__main__':
    main()


###############################################################################
